;;;Command: SCRIMAGE or SRI
;;;Moves, scales and rotates an existing instance of any image matching
;;;two points from the image with two corresponding points from the drawing.
;;;
;;;	Author:	Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;		http://paracadd.com
;;;		All rights reserved.
;;;
;;;		COPYRIGHT: 6/17/2010
;;;		   EDITED: 7/15/2010
;;;
;;;Requires subroutine UPOINT.LSP
;;;
(DEFUN scrimage_error (msg / )
  (SETVAR "NOMUTT" 0)
  (PRINC msg)
  (PRINC)
  (SETQ *error* old_scrimage_error)
  (PRINC)
)
(DEFUN C:SCRIMAGE ()
  (SETQ old_error *error*)
  (SETQ *error* scrimage_error)
  (IF upoint
    nil
    (LOAD "upoint" "\nFile UPOINT.LSP not loaded! ")
  ) ;_ end of if
  (PRINC "\nFirst image orientation point: ")
  (SETVAR "NOMUTT" 1)
  (SETQ img_pt1 (REVERSE (CDR (REVERSE (upoint 1 "" "First image orientation point" nil nil)))))
  (PRINC "\nSecond image orientation point: ")
  (SETQ img_pt2 (REVERSE (CDR (REVERSE (upoint 1 "" "Second image orientation point" nil nil)))))
  (PRINC "\nFirst drawing orientation point: ")
  (SETQ dwg_pt1 (REVERSE (CDR (REVERSE (upoint 1 "" "First drawing orientation point" nil nil)))))
  (PRINC "\nSecond drawing orientation point: ")
  (SETQ dwg_pt2 (REVERSE (CDR (REVERSE (upoint 1 "" "Second drawing orientation point" nil nil)))))
  (PRINC "\nSelect SCale and Rotate IMAGE: ")
  (SETQ image_ss (SSGET '((0 . "IMAGE"))))
  (SETQ image_cnt 0)
  (WHILE (< image_cnt (SSLENGTH image_ss))
    (SETQ this_image (SSNAME image_ss image_cnt))
    (COMMAND ".rotate" this_image "" img_pt1 "r" img_pt1 img_pt2 (* 180.0 (/(ANGLE dwg_pt1 dwg_pt2)PI)))
    (COMMAND ".move" this_image "" img_pt1 dwg_pt1)
    (COMMAND ".scale" this_image "" dwg_pt1 "r" img_pt1 img_pt2 (DISTANCE dwg_pt1 dwg_pt2))
  (SETVAR "NOMUTT" 0)
    (SETQ image_cnt (1+ image_cnt))
  )
) ;_ end of DEFUN
(DEFUN C:SRI () (C:SCRIMAGE))
